﻿using System;
using FluentNHibernate.Mapping;


namespace Entities
{
    public class BaseEntities
    {
        private DateTime _CreatedDate;
        public virtual DateTime CreatedDate
        {
            get
            {
                return _CreatedDate;
            }
            private set
            {
                _CreatedDate = DateTime.Now;
            }
        }
    }

    public class User
    {
        public virtual string UserId { get; private set; }
        public virtual string UserName { get; set; }
        public virtual string Telephone { get; set; }
        public virtual int Email { get; set; }
        internal virtual bool ITSupport { get; set; }
        public virtual BaseEntities BaseEntities { get; set; }
    }

    public class SupportCall
    {
        public virtual int SupportCallId { get; set; }
        public virtual int ApplicationId { get; set; }
        public virtual int CategoryId { get; set; }
        public virtual int SubCategoryId { get; set; }
        public virtual int Priority{ get; set; }
        public virtual DateTime RespondedDate { get; set; }
        public virtual DateTime CompletedDate { get; set; }
        public virtual string Description { get; set; }
        public virtual string ComputerName { get; set; }
        public virtual BaseEntities BaseEntities { get; set; }
    }


    public class BaseEntitiesMap : ComponentMap<BaseEntities>
    {
        public BaseEntitiesMap()
        {
            Map(x => x.CreatedDate);
        }
    }

    public class UserMap : ClassMap<User>
    {
        public UserMap()
        {
            Id(x => x.UserId).Not.Nullable();
            Map(x => x.UserName).Not.Nullable();
            Map(x => x.Telephone);
            Map(x => x.Email).Not.Nullable();
            Component(x => x.BaseEntities);        
        }
    }
    public class ITSupportMap : UserMap
    {
        public ITSupportMap()
        {
            Map(x => x.ITSupport).Default("1");
        }
    }
}
